<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="thx" uri="/thx-tags"%>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>

<section class="content">
	<div class="row">
		<div class="col-md-12">
			<div class="box-header with-border">
				<div class="row">
					<form class="search-panel" action="information/information!list.action" name="search-form" result-container=".right">
						<input type="hidden" name="columnId" value="${columnId}">
						<input type="text" class="form-control" placeholder="请输入信息标题" name="infoTitle" value="${infoTitle}">
						<button type="button" class="btn btn-primary search-btn">搜索</button>
					</form>
				</div>
			</div>
			<div class="box-body no-padding">
				<div class="row">
					<div class="col-sm-12">
						<table class="table table-bordered">
							<tr>
	  							<th>标题</th>
	                            <th>发布范围</th>
	                            <th>发布人</th>
	                            <th>发布时间</th>
	                            <th>浏览次数</th>
	                            <th>操作</th>								
							</tr>
							<c:if test="${empty viewList}">
								<tr>
									<td colspan="6">暂无数据！</td>
								</tr>
							</c:if>
							<c:forEach items="${viewList}" var="e">
								<tr>
									<td>
									<a href="#" class="information-viewBut" data-id="${e.information.infoId}">${e.information.infoTitle}</a>
									<c:if test="${e.information.canComment=='1'}">
<%-- 									<button type="button" 
											title="评论" 
											data-toggle="tooltip"
											data-placement="bottom"
											open-url="information/information!input.action?columnId=${columnId}&id=${e.information.infoId}"
											class="btn btn-default btn-sm btn-open-form">
											<i class="fa fa-commenting"></i>
									</button>	 --%>
									<i class="fa fa-commenting"></i>							
									</c:if>
									<c:if test="${e.information.canVote=='1'}">
	<%-- 								<button type="button" 
											title="投票" 
											data-toggle="tooltip"
											data-placement="bottom"
											open-url="information/information!input.action?columnId=${columnId}&id=${e.information.infoId}"
											class="btn btn-default btn-sm btn-open-form">
											<i class="fa fa-forumbee"></i>
									</button>	 --%>
									<i class="fa fa-bar-chart"></i>								
									</c:if>									
									</td>
									<td>${e.information.selDataPerName}${e.information.selDataDeptName}${e.information.selDataRoleName}</td>
									<td>${e.information.createUser}</td>
									<td>${e.information.createTime}</td>
									<td>${e.viewCount}</td>
									<td>
										<button type="button" 
											title="修改" 
											data-toggle="tooltip"
											data-placement="bottom"
											open-url="information/information!input.action?columnId=${columnId}&id=${e.information.infoId}"
											class="btn btn-default btn-sm btn-open-form">
											<i class="fa fa-edit"></i>
										</button>
										<button type="button"
											title="删除" 
											data-toggle="tooltip"
											data-placement="bottom"
											do-url="information/information!delete.action?columnId=${columnId}&id=${e.information.infoId}"
											load-url="information/information!list.action?columnId=${columnId}" load-container="div.right"
											confirm-msg="确定要删除吗？"
											class="btn btn-default btn-sm btn-open-confirm-win">						
											<i class="fa fa-trash"></i>
										</button>
										<button type="button" 
											title="投票管理" 
											data-toggle="tooltip"
											data-placement="bottom"
											data-id="${e.information.infoId}"
											class="btn btn-default btn-sm information-votestatisticsBut">
											<i class="fa fa-bar-chart"></i>
										</button>										
									</td>
								</tr>
							</c:forEach>
						</table>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<!--分页区-->
				<div class="pagePanel">
					<thx:pages pageNo="page.curPage" total="page.totalPage" theme="number">
						<s:param name="infoTitle" value="infoTitle"></s:param>
					</thx:pages>
				</div>
				<!--底部操作区-->
				<div class="handlePanel">
					<a title="新建消息" open-url="information/information!input.action?columnId=${columnId}"
						class="a-btn btn-open-form"> <span class="fa fa-plus"></span>
						<span class="text">新建</span>
					</a>
				</div>
			</div>
		</div>
	</div>
</section>
<script>
	require([ 'list','util', 'thx-page'], function(list,util, page) {
		list.init();
		page.init(".right");
		var ctxPath = "${pageContext.request.contextPath}";
		var columnId = "${columnId}";
		$(".information-viewBut").click(
			function() {
				var data_id = $(this).attr("data-id");
				var href = ctxPath
						+ '/information/information!view.action?id='+data_id;
				util.ajaxPage(href,'',true,'div.right');
		});
		$(".information-votestatisticsBut").click(
				function() {
					var data_id = $(this).attr("data-id");
					var href = ctxPath
							+ '/information/vote!list.action?id='+data_id;
					util.ajaxPage(href,'',true,'div.right');
		});
	});
</script>

